
package com.wyzz.hr.action;

import java.util.List;

import com.wyzz.hr.base.BaseAction;
import com.wyzz.hr.bo.IDepartmentBO;
import com.wyzz.hr.bo.IEmpSalaryAcctBo;
import com.wyzz.hr.bo.IEmpTypeBO;
import com.wyzz.hr.bo.IEmployeeBo;
import com.wyzz.hr.bo.IJobTitleBo;
import com.wyzz.hr.bo.IJobgradeBO;
import com.wyzz.hr.bo.ILocationBO;
import com.wyzz.hr.spring.SpringBeanFactory;

public class EmployeeBasicInfoConfig extends BaseAction {

	public EmployeeBasicInfoConfig() {
	}

	public String execute() throws Exception {
		ILocationBO localbo = (ILocationBO) SpringBeanFactory
				.getBean("locationBO");
		allLocation = localbo.FindAllLocation();
		IDepartmentBO deptbo = (IDepartmentBO) SpringBeanFactory
				.getBean("departmentBO");
		allDept = deptbo.FindAllDepartment();
		IEmpTypeBO bo = (IEmpTypeBO) SpringBeanFactory.getBean("emptypeBO");
		emptypeList = bo.FindAllEmpType();
		IJobTitleBo jobTitleBo = (IJobTitleBo) SpringBeanFactory
				.getBean("jobTitleBo");
		allJobTitle = jobTitleBo.FindAllJobTitle();
		IEmpSalaryAcctBo empSalaryAcctBo = (IEmpSalaryAcctBo) getBean("empsalaryacctBo");
		empsalaryacctList = empSalaryAcctBo.getObjects(
				com.wyzz.hr.pojo.Empsalaryacct.class, null);
		IJobgradeBO jobgradeBo = (IJobgradeBO) SpringBeanFactory
				.getBean("jobgradeBO");
		jobgradeList = jobgradeBo.FindAllJobgrade();
		return "success";
	}

	public String getEmpNameById(String empId) {
		if (empId == null || empId.equals(""))
			return null;
		IEmployeeBo empBo = (IEmployeeBo) SpringBeanFactory.getBean("empBo");
		if (empId.indexOf(",") >= 0) {
			String ids[] = empId.split(",");
			String name = empBo.loadEmp(ids[0], null).getEmpName();
			return (new StringBuilder()).append(name).append(",...").toString();
		} else {
			return empBo.loadEmp(empId, null).getEmpName();
		}
	}

	public List getAllBusinessUnit() {
		return allBusinessUnit;
	}

	public void setAllBusinessUnit(List allBusinessUnit) {
		this.allBusinessUnit = allBusinessUnit;
	}

	public List getAllDept() {
		return allDept;
	}

	public void setAllDept(List allDept) {
		this.allDept = allDept;
	}

	public List getAllLocation() {
		return allLocation;
	}

	public void setAllLocation(List allLocation) {
		this.allLocation = allLocation;
	}

	public List getEmptypeList() {
		return emptypeList;
	}

	public void setEmptypeList(List emptypeList) {
		this.emptypeList = emptypeList;
	}

	public List getAllJobTitle() {
		return allJobTitle;
	}

	public void setAllJobTitle(List allJobTitle) {
		this.allJobTitle = allJobTitle;
	}

	public List getAllGroup() {
		return allGroup;
	}

	public void setAllGroup(List allGroup) {
		this.allGroup = allGroup;
	}

	public List getEmpsalaryacctList() {
		return empsalaryacctList;
	}

	public void setEmpsalaryacctList(List empsalaryacctList) {
		this.empsalaryacctList = empsalaryacctList;
	}

	public List getJobgradeList() {
		return jobgradeList;
	}

	public void setJobgradeList(List jobgradeList) {
		this.jobgradeList = jobgradeList;
	}

	private List emptypeList;
	private List allLocation;
	private List allDept;
	private List allBusinessUnit;
	private List allJobTitle;
	private List allGroup;
	private List empsalaryacctList;
	private List jobgradeList;
}
